<?php

require_once('../include/connectBDD.php');
require_once('../class/securite.class.php');

require_once('../class/idee.class.php');

$idee = new idee();
$idee->charge($_GET['idIdee']);

$query = "SELECT idVote FROM vote WHERE idIdee = '" . securite::bdd($_GET['idIdee']) . "' AND idU ='" . securite::bdd($_GET['idU']) . "' ; ";
$result = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result) == 0)
{
    $idee->set_nbVote(securite::bdd($_GET['value']), securite::bdd($_GET['idU']));
    
    $idee->charge($_GET['idIdee']);
   echo $idee->get_nbVote();
}
else
    echo utf8_encode('NULL');
?>